<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
            <title>
                列表页
            </title>
            <link href="/public/css/bootstrap.min.css" rel="stylesheet">
                <link href="/public/css/animate.min.css" rel="stylesheet">
                    <link href="/public/css/jquery.gDialog.css" rel="stylesheet">
                    </link>
                </link>
            </link>
        </meta>
    </head>
    <body>
        <!-- header start -->
        <div class="jumbotron">
            <div class="container">
                <h1>
                    CURD 练习
                </h1>
                <h2>
                    ——玩转表单
                </h2>
                <h3>
                    <eq name="Think.session.islogin" value="1">
                        欢迎回来{:I('session.res')['zh'] }
                        <img src="/Public/Uploads/{:I('session.res')['pic'] }" alt="">
                    </eq>
                </h3>
            </div>
        </div>
        <!-- header end -->
        <!-- content start -->
        <div class="container content">
            <div class="row">
                <div class="sidebar col-md-3">
                    <div class="list-group">
                        <a class="list-group-item active " href="{:U('Home/Index/detail')}">
                            学生列表
                        </a>
                        <a class="list-group-item " href="{:U('Home/Index/add')}">
                            新增学生
                        </a>
                    </div>
                </div>
                <div class="main col-md-9">
                    <div class="alert alert-success" role="alert">
                        添加成功-1001
                        <button class="close" data-dismiss="alert" type="button">
                            <span aria-hidden="true">
                                ×
                            </span>
                            <span class="sr-only">
                                Close
                            </span>
                        </button>
                    </div>
                   <form class="form-inline" role="form" action="{:U('Home/Index/index')}" method="get">
                <div class="input-group col-md-12">

                <div class="form-group col-md-3">
                        <input class="form-control " type="text" placeholder="姓名中包含" name="name" value="">
                </div>

                <div class="form-group col-md-3">
                        <input class="form-control " type="text" placeholder="最大年龄" name="maxage" value="">
                </div>

                <div class="form-group col-md-3">
                        <input class="form-control " type="text" placeholder="最小年龄" name="minage" value="">
                </div>
                        <input  type="radio" name="sex" value="男">男
                        <input  type="radio" name="sex" value="女">女
                        <select class="form-control " name="class">
                            <option value="">班级</option>
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                             <option value="4">4</option>
                              <option value="5">5</option>
                        </select>
                        <span class="input-group-btn">
                            <button class="btn btn-default" type="submit" value="查询">查询</button>
                        </span>
                    
                </div>
            </form>

                    <br>
                        <div class="panel panel-default">
                            <!-- Default panel contents -->
                            <div class="panel-heading">
                                学生列表
                            </div>
                            <!-- Table -->
                            <table class="table table-striped table-hover">
                                <tr class="th">
                                    <td>
                                        编号
                                    </td>
                                    <td>
                                        姓名
                                    </td>
                                    <td>
                                        性别
                                    </td>
                                    <td>
                                        年龄
                                    </td>
                                    <td>
                                        班级
                                    </td>
                                    <td>
                                        操作
                                    </td>
                                </tr>
                                <foreach item="v" name="arr">
                                    <tr>
                                        <td>
                                            {$v['id']}
                                        </td>
                                        <td>
                                            {$v['name']}
                                        </td>
                                        <td>
                                            {$v['sex']}
                                        </td>
                                        <td>
                                            {$v['age']}
                                        </td>
                                        <td>
                                            {$v['class']}
                                        </td>
                                        <td>
                                            <a href="{:U('Home/Index/detail',['id'=>$v['id']])}">
                                                详情
                                            </a>
                                            <a href="{:U('Home/Index/update',['id'=>$v['id']])}">
                                                编辑
                                            </a>
                                            <a href="{:U('Home/Index/del',['id'=>$v['id']])}" onclick="if(confirm('确定删除吗？')===false) return false">
                                                删除
                                            </a>
                                        </td>
                                    </tr>
                                </foreach>
                            </table>
                        </div>
                        <nav class="text-right" >
                          <button class="prev">上一页</button>
                          <button class="next">下一页</button>

                        </nav>
                    </br>
                </div>
            </div>
        </div>
        <!-- content end -->
        <!--footer start-->
        <div class="jumbotron" style="margin-bottom: 0px;">
            <div class="container">
                <h5>
                    ©2016-12-12 by dp
                </h5>
            </div>
        </div>
        <!--footer end-->
        <!-- script start -->
        <script src="/public/js/jquery-1.8.3.min.js">
        </script>
        <script src="/public/js/bootstrap.min.js">
        </script>
        <script src="/public/js/highlight.min.js">
        </script>
        <script src="/public/js/jquery.gDialog.min.js">
        </script>
        <script src="/public/js/holder.min.js">
        </script>
        <!-- script end -->
         <script>
        $(function(){
            var p=1;
            $(".next").click(function(){
                p++;
                var url="{:U('Home/Index/index',I('get.'))}";
                $.get(url,{p:p},function(SLZ){
                       if (SLZ.status==1) {
                    $(".th").nextAll().remove();
                    $(".th").after(SLZ.data);
                     }else{
                    p--;
                }     
                });
           
            });
            $(".prev").click(function(){
                p--;
               
                var url="{:U('Home/Index/index',I('get.'))}";
                $.get(url,{p:p},function(SLZ){
                  if (SLZ.status==1) {
                    $(".th").nextAll().remove();
                    $(".th").after(SLZ.data);
                }else{
                    p++;
                }               

                });
            
            });

        });

    </script>
    </body>
   
</html>